﻿using System;
using System.Web;
using System.Data;

namespace msBsc.WebUi
{
    public partial class mfOrderDetail : msBsc.Cls.mbPCustom
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ShowData(this.Request.QueryString.Get("ID"), this.Request.QueryString.Get("NO"));
            }
        }

        public DataRow drOrder = null;
        public DataRow drShop = null;
        private string strOrderId = "";

        private void ShowData(string strId, string strNo)
        {
            if (string.IsNullOrEmpty(strId) && string.IsNullOrEmpty(strNo))
            {
                this.ToErrPage("当前要查看的订单未找到，请返回重新选择！");
                return;
            }
            using (msBsc.AppLogic.DataAlc.CBizShpOrderForm oCDbAccess = new msBsc.AppLogic.DataAlc.CBizShpOrderForm())
            {
                System.Data.DataSet ds;
                if (!string.IsNullOrEmpty(strId))
                {
                    ds = oCDbAccess.SelectById(strId);
                }
                else
                {
                    ds = oCDbAccess.SelectByNos(strNo);
                }
                if (ds.Tables[0].Rows.Count <= 0)
                {
                    this.ToErrPage("当前要查看的订单未找到，请返回重新选择！");
                    return;
                }
                else
                {
                    if (msBsc.SvRef.UserInfo.OperType != "0")
                    {
                        if (ds.Tables[0].Rows[0]["USER_NME"].ToString().ToUpper() != msBsc.SvRef.UserInfo.Operator.ToUpper())
                        {
                            this.ToErrPage("非法的访问，只能查看自己购买的订单！");
                            return;
                        }
                    }

                    DataSet dsshop = oCDbAccess.DataObj.QueryBySQL(@"
    SELECT
    PROVINCE_ID
    ,CITY_ID
    ,AREA_ID
    ,ZONE_DESC
    ,CONTACTS
    ,CONTACTS_EMAIL
    ,CONTACTS_TEL
    ,CONTACTS_ADDRESS
    ,CONTACTS_PHONE FROM SHP_COMMERCIAL_TENANT_INFO WHERE COMM_TENANT_ID='" + ds.Tables[0].Rows[0]["COMM_TENANT_ID"].ToString() + "'");
                    drShop = dsshop.Tables[0].Rows[0];

                    strOrderId = ds.Tables[0].Rows[0]["ORDER_FORM_ID"].ToString();
                    this.ExecJScript("$('#txtId').val('" + strOrderId + "');");
                    drOrder = ds.Tables[0].Rows[0];
                }
            }
        }
        public override void DoAction()
        {
            if (this.strAction == "doUpateAmt")
            { 
            }
            else if (this.strAction == "doConfirmPay")
            { 
            }
        }

    }
}